//
//  UIView+SLBExtension.m
//  Pods
//
//  Created by Senmiao on 2016/12/15.
//
//

#import "UIView+SLBExtension.h"


@implementation UIView (SLBExtension)

- (CGFloat)X
{
    return [self point].x;
}

- (void)setX:(CGFloat)X {
    self.point = CGPointMake(X, self.point.y);
}

- (CGFloat)Y {
    return [self point].y;
}

- (void)setY:(CGFloat)Y {
    self.point = CGPointMake(self.point.x, Y);
}

- (CGFloat)W
{
    return [self size].width;
}

- (void)setW:(CGFloat)W {
    self.size = CGSizeMake(W, self.size.height);
}

- (CGFloat)H
{
    return [self size].height;
}

- (void)setH:(CGFloat)H
{
    self.size = CGSizeMake(self.size.width, H);
}

- (void)setSize:(CGSize)size
{
    self.frame = (CGRect){self.point,size};
}

- (CGSize)size
{
    return  self.frame.size;
}

-(void)setPoint:(CGPoint)point
{
    CGRect frame = self.frame;
    frame.origin = point;
    self.frame = frame;
}

- (CGPoint)point
{
    return self.frame.origin;
}


- (void)setCenterX:(CGFloat)centerX
{
    CGPoint center = self.center;
    center.x = centerX;
    self.center = center;
}

- (void)setCenterY:(CGFloat)centerY
{
    CGPoint center = self.center;
    center.y = centerY;
    self.center = center;
}

- (CGFloat)centerX
{
    return self.center.x;
}

- (CGFloat)centerY
{
    return self.center.y;
}

- (CGFloat)top
{
    return [self Y];
}

- (void)setTop:(CGFloat)top {
    [self setY:top];
}

- (CGFloat)left
{
    return [self X];
}

- (void)setLeft:(CGFloat)left {
    [self setX:left];
}

- (CGFloat)right
{
    return CGRectGetMaxX(self.frame);
}

- (CGFloat)bottom
{
    return CGRectGetMaxY(self.frame);
}

- (void)setRight:(CGFloat)right
{
    self.X = right - self.W;
}

- (void)setBottom:(CGFloat)bottom
{
    self.Y = bottom - self.H;
}


@end
